﻿using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SignalRCoreTest.Hubs
{
    public class GroupHub : Hub
    {
        public async Task AddGroupAsync(string groupName)
        {
            await Groups.AddToGroupAsync(this.Context.ConnectionId, groupName);
        }

        public async Task SendGroupMsgAsync(string groupName, string msg)
        {
            await Clients.OthersInGroup(groupName).SendAsync("onMessage",msg);
            await Clients.OthersInGroup(groupName).SendAsync("onMessage1",msg);
        }
    }
}
